import type { AppRouteRecordRaw } from '/@/router/types'
// import { PAGE_NOT_FOUND_ROUTE } from './basic'
const routes: AppRouteRecordRaw[] = [
  {
    path: '/layout',
    component: () => import('@/layouts/default/index.vue'),
    name: 'layout',
    redirect: '/dashboard',
    meta: { title: '首页' },
    children: [
      {
        path: '/dashboard',
        name: 'DashBoard',
        redirect: '/dashboard/home',
        meta: { title: '仪表盘' },
        children: [
          {
            path: '/dashboard/home',
            name: 'Home',
            component: () => import('@/views/system/dashboard/home.vue'),
            meta: { title: '首页' },
          },
          {
            path: '/dashboard/workbench',
            name: 'WorkBench',
            component: () => import('@/views/system/dashboard/workbench.vue'),
            meta: { title: '工作台' },
          },
        ],
      },
      {
        path: '/personal',
        name: 'Personal',
        redirect: '/personal/task',
        meta: { title: '个人办公' },
        children: [
          {
            path: '/personal/task',
            name: 'Task',
            component: () => import('/@/views/system/personal/task/index.vue'),
            meta: { title: '我的任务' },
          },
          {
            path: '/personal/workflow',
            name: 'Workflow',
            component: () => import('@/views/system/personal/workflow.vue'),
            meta: { title: '我发起流程' },
          },
          {
            path: '/personal/copy',
            name: 'Copy',
            component: () => import('@/views/system/personal/copy.vue'),
            meta: { title: '我的抄送' },
          },
        ],
      },
      {
        path: '/personalapply',
        name: 'PersonalApply',
        redirect: '/personalapply/leave',
        meta: { title: '个人申请' },
        children: [
          {
            path: '/personalapply/leave',
            name: 'Leave',
            component: () => import('@/views/system/personalapply/leave.vue'),
            meta: { title: '请假申请' },
          },
          {
            path: '/personalapply/business',
            name: 'Business',
            component: () => import('@/views/system/personalapply/business.vue'),
            meta: { title: '出差申请' },
          },
          {
            path: '/personalapply/reimbursement',
            name: 'Reimbursement',
            component: () => import('@/views/system/personalapply/reimbursement.vue'),
            meta: { title: '报销申请' },
          },
          {
            path: '/personalapply/document',
            name: 'Document',
            component: () => import('@/views/system/personalapply/document.vue'),
            meta: { title: '公文发送' },
          },
          {
            path: '/personalapply/apply',
            name: 'Apply',
            component: () => import('@/views/system/personalapply/apply.vue'),
            meta: { title: '我的申请' },
          },
        ],
      },
      {
        path: '/system/setting',
        name: 'SystemSetting',
        component: () => import('@/views/system/setting.vue'),
        meta: { title: '系统设置' },
      },
      {
        path: '/demo',
        name: 'Demo',
        redirect: '/demo/button',
        meta: { title: '按钮' },
        children: [
          {
            path: '/demo/button',
            name: 'DemoButton',
            component: () => import('@/views/demo/button.vue'),
            meta: { title: '按钮' },
          },
          {
            path: '/demo/message',
            name: 'DemoMessage',
            component: () => import('@/views/demo/message.vue'),
            meta: { title: '消息' },
          },
          {
            path: '/demo/table',
            name: 'DemoTable',
            component: () => import('@/views/demo/table.vue'),
            meta: { title: '表格' },
          },
          {
            path: '/demo/form',
            name: 'DemoForm',
            component: () => import('@/views/demo/form.vue'),
            meta: { title: '表单' },
          },
        ],
      },
      {
        path: '/oaOffice',
        name: 'OaOffice',
        redirect: '/oaOffice/orderApplyList',
        meta: { title: 'OA申请' },
        children: [
          {
            path: '/oaOffice/orderApplyList',
            name: 'OrderApplyList',
            component: () => import('/@/views/system/oaOffice/orderAudit.vue'),
            meta: { title: '工单申请' },
          },
          {
            path: '/oaOffice/myOrder',
            name: 'MyOrder',
            component: () => import('@/views/system/oaOffice/myOrder.vue'),
            meta: { title: '我的工单' },
          },
          {
            path: '/oaOffice/orderAudit',
            name: 'OrderAudit',
            component: () => import('@/views/system/oaOffice/orderAudit.vue'),
            meta: { title: '工单审核' },
          },
        ],
      },
      {
        path: '/company',
        name: 'Company',
        redirect: '/company/user',
        meta: { title: '企业管理' },
        children: [
          {
            path: '/company/user',
            name: 'User',
            component: () => import('@/views/system/company/user.vue'),
            meta: { title: '人员管理' },
          },
          {
            path: '/company/role',
            name: 'Role',
            component: () => import('@/views/system/company/role.vue'),
            meta: { title: '角色管理' },
          },
          {
            path: '/company/team',
            name: 'Team',
            component: () => import('@/views/system/company/team.vue'),
            meta: { title: '团队管理' },
          },
          {
            path: '/company/department',
            name: 'Department',
            component: () => import('@/views/system/company/department.vue'),
            meta: { title: '部门管理' },
          },
        ],
      },
      {
        path: '/message',
        name: 'Message',
        redirect: '/message/template',
        meta: { title: '消息中心' },
        children: [
          // 子菜单列表
          {
            path: '/message/template',
            name: 'Template',
            component: () => import('@/views/system/message/template.vue'),
            meta: { title: '消息模版' },
          },
          {
            path: '/message/index',
            name: 'MyMessage',
            component: () => import('/@/views/system/message/index.vue'),
            meta: { title: '我的消息' },
          },
          {
            path: '/message/push',
            name: 'MessagePush',
            component: () => import('/@/views/system/message/push.vue'),
            meta: { title: '消息推送' },
          },
        ],
      },
    ],
  },
  {
    path: '/404',
    component: () => import('@/views/system/404.vue'),
    name: '404',
    meta: { title: '404' },
  },
  {
    // 任意路由，配置所有路由都没有配置上的时候展示的路由
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'Any',
    meta: { title: '404' },
  },
]

// Redirect root path to dashboard
export const RootRoute: AppRouteRecordRaw = {
  path: '/',
  name: 'Root',
  redirect: '/login',
  meta: {
    title: 'Root',
  },
}

export const LoginRoute: AppRouteRecordRaw = {
  path: '/login',
  name: 'Login',
  component: () => import('@/views/system/login/login.vue'),
  meta: {
    title: '登录',
  },
}

export const basicRoutes = [LoginRoute, RootRoute, ...routes]
